@flex-horizontal: {
  display: flex;
  flex-direction: row;
};
@flex-vertical: {
  display: flex;
  flex-direction: column;
};
@toggle: {
  width: 40px;
  vertical-align: middle;
  height: auto;
  border: none;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: center left;

  &:checked {
    background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E');
  }
};

html,
body {
  font-family: system-ui, Arial, sans-serif, Menlo, 'Bitstream Vera Sans Mono',
    'Ubuntu Mono', Consolas, 'Courier New', Courier, monospace;
  margin: 0;
  padding: 0;
}

body {
  line-height: 1.4em;
  background: #f5f5f5;
  color: #4d4d4d;
  min-width: 230px;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 300;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 100%;
  vertical-align: baseline;
  font-family: inherit;
  font-weight: inherit;
  appearance: none;
  cursor: pointer;

  &:hover {
    color: rgba(175, 47, 47);
  }
}

ul,
ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

#app {
  background: #fff;
  margin: 200px 0 40px 0;
  position: relative;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);

  & .title {
    text-align: center;
    position: absolute;
    top: -200px;
    width: 100%;
    font-size: 80px;
    font-weight: 100;
    color: rgba(175, 47, 47, 0.15);
    text-rendering: optimizeLegibility;

    & .logo {
      width: 64px;
      margin-bottom: 24px;
    }
  }

  & .copyright {
    position: absolute;
    width: 100%;
    margin: 32px auto 0;
    color: #bfbfbf;
    font-size: 10px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    text-align: center;

    & p {
      line-height: 1;
    }

    & a {
      color: inherit;
      text-decoration: none;
      font-weight: 400;

      &:hover {
        text-decoration: underline;
      }
    }
  }

  & .new-todo {
    @flex-horizontal();
    line-height: 1.4em;
    padding: 6px 6px 6px 0;
    box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    border: none;

    & .toggle-all {
      @toggle();
    }

    & .new-todo-input {
      flex: 1;
      outline: 0;
      font-size: 24px;
      padding: 16px;
      border: none;

      &::-webkit-input-placeholder {
        font-style: italic;
        font-weight: 300;
        color: #e6e6e6;
      }
    }
  }

  & .todo-list {
    & .todo-item {
      @flex-horizontal();
      font-size: 24px;
      border-bottom: 1px solid #ededed;
      height: auto;

      &:last-child {
        border-bottom: none;
      }

      & .toggle {
        @toggle();
        // transition: 0.2s;
      }

      & .view {
        flex: 1;

        &.done .todo-text {
          text-decoration: line-through;
          color: #ccc;
        }

        & .todo-text {
          display: inline-block;
          outline: none;
          word-break: break-all;
          padding: 15px;
          line-height: 1.2;
          // transition: 0.2s;

          &:focus {
            box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.1),
              inset 2px 2px 3px rgba(0, 0, 0, 0.1);
          }
        }
      }

      & .destroy {
        padding: 15px;
        display: none;
        cursor: pointer;
        width: 20px;
        color: rgba(255, 0, 0, 0.7);
        font-weight: 100;
      }

      &:hover .destroy {
        display: flex;
        align-items: center;
      }
    }
  }

  & .footer {
    @flex-horizontal();
    align-items: center;
    color: #777;
    padding: 8px 15px;
    border-top: 1px solid #e6e6e6;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6,
      0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6,
      0 17px 2px -6px rgba(0, 0, 0, 0.2);

    & .clear-all,
    .info {
      width: 100px;
    }

    & .filters {
      flex: 1;
      text-align: center;

      & button {
        margin: 3px;
        padding: 3px 7px;
        border-radius: 3px;
        border: 1px solid transparent;
        &.selected {
          border-color: rgba(175, 47, 47, 0.2);
        }
      }
    }
  }
}
